import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';

export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'content',
    label: '内容',
  },
  {
    component: 'Input',
    fieldName: 'title',
    label: '标题',
  },
  {
    component: 'Textarea',
    fieldName: 'prompt',
    label: '提示词',
  },
  {
    component: 'Input',
    fieldName: 'contentImg',
    label: '图片',
  },
  {
    component: 'Input',
    fieldName: 'model',
    label: '模型',
  },
  {
    component: 'Input',
    fieldName: 'employeeId',
    label: '员工ID',
  },
  {
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      optionType: 'button',
    },
    fieldName: 'status',
    label: '状态',
  },
  {
    component: 'Input',
    fieldName: 'designerId',
    label: 'HTML 设计师ID',
  },
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  {
    title: '主键',
    field: 'id',
  },
  {
    title: '内容',
    field: 'content',
  },
  {
    title: '标题',
    field: 'title',
  },
  {
    title: '提示词',
    field: 'prompt',
  },
  {
    title: '图片',
    field: 'contentImg',
  },
  {
    title: '模型',
    field: 'model',
  },
  {
    title: '员工ID',
    field: 'employeeId',
  },
  {
    title: '状态',
    field: 'status',
  },
  {
    title: 'HTML 设计师ID',
    field: 'designerId',
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];

export const modalSchema: FormSchemaGetter = () => [
  {
    label: '主键',
    fieldName: 'id',
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    label: '内容',
    fieldName: 'content',
    component: 'RichTextarea',
    componentProps: {
      // options: {
      //  readyonly: false, // 是否只读
      // }
      // width: '100%', // 宽度
      // showImageUpload: true, // 是否显示图片上传
      // height: 400 // 高度 默认400
    },
    rules: 'required',
  },
  {
    label: '标题',
    fieldName: 'title',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '提示词',
    fieldName: 'prompt',
    component: 'Textarea',
    rules: 'required',
  },
  {
    label: '图片',
    fieldName: 'contentImg',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '模型',
    fieldName: 'model',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '员工ID',
    fieldName: 'employeeId',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '状态',
    fieldName: 'status',
    component: 'RadioGroup',
    componentProps: {
      buttonStyle: 'solid',
      optionType: 'button',
    },
    rules: 'selectRequired',
  },
  {
    label: 'HTML 设计师ID',
    fieldName: 'designerId',
    component: 'Input',
    rules: 'required',
  },
];
